package com.ag.zlw.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ag.bean.TbWorkDay;
import com.ag.common.AgException;
import com.ag.common.IDUtil;
import com.ag.common.IIDService;
import com.ag.zlw.dao.TbWorkDayDAO;
import com.ag.zlw.service.WorkDayService;

/**
 * 工作日
 * 
 * @author 钟龙伟
 * 
 */

@Service("WorkDayService")
public class WorkDayServiceImpl implements WorkDayService {
	@Resource(name = "ZLWTbWorkDayDAO")
	private TbWorkDayDAO tbWorkDayDAO;

	private String IDs;
	@Resource(name = "iDServiceImpl")
	private IIDService idservice;

	public void save(TbWorkDay WorkDay) throws AgException {
		IDs = (String) idservice.findTablePK(IDUtil.TB_WORK_DAY);
		WorkDay.setWdId(IDs);
		tbWorkDayDAO.save(WorkDay);
	}

	public List<TbWorkDay> findAll() {
		return tbWorkDayDAO.findAll();
	}

	public void delete(TbWorkDay WorkDay) {
		TbWorkDay tbWorkDay = tbWorkDayDAO.findById(WorkDay.getWdId());
		tbWorkDay.setA(IDUtil.DELETE);
		tbWorkDayDAO.attachDirty(tbWorkDay);
	}

	public void modify(TbWorkDay WorkDay) {
		tbWorkDayDAO.attachDirty(WorkDay);
	}
}
